package com.fr.dialog.core;

import com.fr.base.Inter;
import com.fr.cell.core.GUICoreUtils;
import java.awt.Component;
import javax.swing.DefaultComboBoxModel;
import javax.swing.DefaultListCellRenderer;
import javax.swing.JComboBox;
import javax.swing.JList;

public class AlignmentComboBox extends JComboBox
{
  public AlignmentComboBox(int[] paramArrayOfInt)
  {
    Integer[] arrayOfInteger = new Integer[paramArrayOfInt.length];
    for (int i = 0; i < paramArrayOfInt.length; ++i)
      arrayOfInteger[i] = new Integer(paramArrayOfInt[i]);
    setModel(new DefaultComboBoxModel(arrayOfInteger));
    setRenderer(new AligmentCellRenderer(this));
  }

  public int getSelectedAlignment()
  {
    return ((Integer)getSelectedItem()).intValue();
  }

  public void setSelectedAlignment(int paramInt)
  {
    GUICoreUtils.setSelectedItem(this, new Integer(paramInt));
  }

  class AligmentCellRenderer extends DefaultListCellRenderer
  {
    private final AlignmentComboBox this$0;

    AligmentCellRenderer()
    {
      this.this$0 = paramAlignmentComboBox;
    }

    public Component getListCellRendererComponent(, Object paramObject, int paramInt, boolean paramBoolean1, boolean paramBoolean2)
    {
      super.getListCellRendererComponent(paramJList, paramObject, paramInt, paramBoolean1, paramBoolean2);
      int i = ((Integer)paramObject).intValue();
      if (i == 0)
        setText(Inter.getLocText("Center"));
      else if (i == 1)
        setText(Inter.getLocText("StyleAlignment-Top"));
      else if (i == 2)
        setText(Inter.getLocText("StyleAlignment-Left"));
      else if (i == 3)
        setText(Inter.getLocText("StyleAlignment-Bottom"));
      else if (i == 4)
        setText(Inter.getLocText("StyleAlignment-Right"));
      else if (i == 6)
        setText(Inter.getLocText("StyleAlignment-Distibuted"));
      return this;
    }
  }
}